1. Field of the Invention
The present invention relates to an image processing apparatus and method for encoding an image, and a storage medium that stores the method.
2. Related Background Art
Since images have a very large information size, the huge data size poses a problem when an image is stored or transmitted. Compression (encoding) of an image reduces the data size by removing redundancy of the image or manipulating values on levels that such manipulations are hard to visually recognize.
Conventionally, as one of still image encoding methods, JPEG internationally recommended by the ISO and ITU-T is known. JPEG will be briefly explained below since it is described in detail in ITU-T Recommendation T.81, ISO/IEC 10918-1, and the like. In JPEG, several kinds of encoding schemes are specified in correspondence with images to be encoded and applications. However, in its basic scheme except for a reversible process, an image is segmented into 8xc3x978 blocks, the blocks undergo the discrete cosine transform (DCT), and transform coefficients are appropriately quantized and are then encoded. In this scheme, since the DCT is done in units of blocks, so-called block distortion is produced, i.e., block boundaries are visible when transform coefficients are coarsely quantized and encoded.
On the other hand, recently, encoding schemes based on the wavelet transform have been extensively studied, and various encoding schemes using this transform have been proposed. Since the wavelet transform does not use block division, it does not suffer any block distortion, and image quality at high compression ratio is superior to that of JPEG.
In the wavelet transform of an image, as shown in FIG. 2, an original image is divided into four frequency bands LL, HL, LH, and HH, and processes for further dividing the lowest frequency band (LL(1)) of these divided bands into four frequency bands, and further dividing the lowest frequency band (LL(2)) of these divided bands are repeated for a predetermined number of times, thus generating 3m+1 (the number of times of wavelet transform) kinds of frequency bands. The number of times of repetitions of the wavelet transform will be referred to as a level count hereinafter, and the respective frequency bands will be referred to as LL(m), HL(m), LH(m), and HH(m) by appending the level count to LL, HL, LH, and HH. For example, the LH component obtained by repeating the wavelet transform twice is expressed by LH(2).
Conventionally, it is often inappropriate to execute the wavelet transform for some types of images to be encoded. For example, as for a multi-valued binary image, limited color image, CG image, or the like, the coding efficiency can be improved when such image data undergoes a compression process as a post process of the wavelet transform before the wavelet transform, rather than the compression process after the wavelet transform.
Even when image data undergoes the wavelet transform, an appropriate number of times of wavelet transform (level count) varies depending on images, area (tile) sizes), characteristics, and the like, and a large number of times of wavelet transform does not always lead to improvement in compression performance.
The present invention has been made in consideration of the aforementioned problems, and has as its object to provide a novel image encoding scheme which can efficiently encode images with various characteristics.
More specifically, it is an object of the present invention to provide a technique for implementing efficient encoding in correspondence with the characteristics of an image to be encoded when an input image is encoded while being divided into a plurality of frequency bands.
In order to achieve the above objects, according to a preferred embodiment of the present invention, there is provided an image processing apparatus comprising:
generation means for generating a plurality of sample values representing an image;
transforming means for frequency-transforming the plurality of sample values into coefficients of a plurality of frequency bands;
encoding means for generating first encoded data by encoding the plurality of sample values, and generating second encoded data by encoding the plurality of coefficients obtained by the transforming means;
comparing means for comparing amounts of the first and second encoded data obtained by encoding of the encoding means; and
selection means for outputting one of the first and second encoded data in accordance with a comparison result of the comparing means.